package cn.qingyun.gis.modules.scenes.controller;

import cn.qingyun.gis.common.Result;
import cn.qingyun.gis.modules.scenes.entity.PoiUserPermission;
import cn.qingyun.gis.modules.scenes.service.PoiUserPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * @author LHJ
 * @description
 * @date 2024/7/1 21:45
 */
@Slf4j
@RestController
@RequestMapping("/admin/scenes/permission")
public class PoiUserPermissionController {

    @Resource
    private PoiUserPermissionService poiUserPermissionService;
    /**
     * 查询用户是否存在
     * @return
     */
    @GetMapping(value = "/exist")
    public Result<?> selectUserExist(@NotNull(message = "区县编码不能为空") @RequestParam("telNum") String telNum) {
        log.debug("校验用户是否存在入参工号，{}", telNum);
        PoiUserPermission poiUserPermission = poiUserPermissionService.selectUserByTelNumber(telNum);
        if (poiUserPermission!=null){
            return Result.okData(true);
        }
        return Result.okData(false);
    }
}
